package com.itheima_6;

import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

import java.util.concurrent.Semaphore;

public class MyRunnable implements Runnable{
    Semaphore s=new Semaphore(2);
    @Override
    public void run() {
        try {
            s.acquire();
            System.out.println("获得了通行证开始行驶");
                Thread.sleep(1000);
            System.out.println("归还通行证");
            s.release();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }
}
